-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tools to sysroot after build. #102010
Conversation
With the power of Lines 1107 to 1108 in 503e19d
|
Hmm, I don't recall why we delete the whole sysroot, but copying the whole |
✨ Try it and see ✨ :P can you run I do think we should support miri, but it sounds like you're asking specifically about |
Hm, have you meant ; ls build/x86_64-unknown-linux-gnu/stage1-tools-bin
cargo-miri clippy-driver miri rust-analyzer-proc-macro-srv rustfmt
; ls build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release
build cargo-fmt.d clippy-driver.d git-rustfmt.d librustfmt_nightly.d rust-analyzer-proc-macro-srv rustfmt-format-diff
cargo-clippy cargo-miri deps incremental librustfmt_nightly.rlib rust-analyzer-proc-macro-srv.d rustfmt-format-diff.d
cargo-clippy.d cargo-miri.d examples libmiri.d miri rustfmt
cargo-fmt clippy-driver git-rustfmt libmiri.rlib miri.d rustfmt.d |
I meant |
I don't think we should copy everything - e.g., compiletest shouldn't get copied into the sysroot. In general, the reason we delete the directory is to make sure that we don't have cases where order of running x.py commands matters. I would expect the deletion to happen before we copy into the directory though, because it should only happen once per run and we should invoke the relevant Step before copying things into it. |
It does happen before the copy, but only the just-built thing and |
How does this help? It seems like all files in |
I don't think this is necessarily true (e.g., you might have one binary executing another), and it's much easier for something that is kept around persistently to e.g. have a stale binary that you don't realize should have been rebuilt and giving you very confusing results.
Presumably this doesn't happen if you build both at once, e.g., |
IMO it would make more sense if we would clear the directory only when ; x b compiler # clears the directory
; x b miri # leaves the directory as-is
; x b rustfmt # leaves the directory as-is
; nano compiler/... # change compiler
; x b miri # compiler is rebuilt => clears the directory |
☔ The latest upstream changes (presumably #102028) made this pull request unmergeable. Please resolve the merge conflicts. |
I suppose that's possible, but I'm typically very wary of conditional clearing for that kind of directory. It's currently the case that all sysroots managed by rustbuild are always re-created on every build (AFAIK), which is a really convenient property for the implementation. In most cases if the goal is a "stable" sysroot, I sort of want to say "x.py install" or similar is the right way to get that, not trying to make the existing sysroots more durable. Part of the reason I worry here is that "only when rustc is rebuilt" is a pretty annoying property to actually get; we don't directly know in rustbuild when something is rebuilt, cargo does caching for us. We do have some clear_if_dirty and such, with stamps, but that's really something that we're trying to move away from over time because getting them right is really tricky. (For an example: changing codegen can mean that you've not modified the rustc binary, so its timestamp hasn't changed, but the librustc_codegen_llvm.so has, and we're not tracking that, so you end up with an inconsistent state where newly built binaries (e.g., tools, etc.) are linking against a potentially old std built by the old rustc. It is much simpler to always re-hard-link everything and gives you a lot of nice properties as a result. |
@WaffleLapkin let's require for now that people need to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM other than the one question :)
f79a1c0
to
e8020e2
Compare
I can't get thread 'main' panicked at 'failed to determine underlying rustc version of Miri: CommandError { stdout: "", stderr: "/home/waffle/rust-b/build/x86_64-unknown-linux-gnu/stage1/bin/miri: error while loading shared libraries: librustc_driver-152a9025dac882e1.so: cannot open shared object file: No such file or directory\n" }', src/tools/miri/cargo-miri/src/util.rs:116:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
clippy doesn't work either, although for a different reason. error: no `build` rules matched ["cargo-clippy"]
help: run `x.py build --help --verbose` to show a list of available paths
note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`
Build completed unsuccessfully in 0:00:00 |
Lines 869 to 870 in 91931ec
We then only allow one thing to be called with a given path: Lines 316 to 326 in 91931ec
So only the first one (happens to be If I change paths to be different bootstrap tries to build both (I say tries, because Not sure what to do with this though |
☔ The latest upstream changes (presumably #102691) made this pull request unmergeable. Please resolve the merge conflicts. |
I think that's a bug in miri itself:
We can worry about fixing that once your PR is merged :) I agree the clippy stuff looks like a bug in bootstrap itself, I've pushed a commit that should fix it. |
r? @Mark-Simulacrum for the commit that allows multiple steps to share the same path |
r=me, seems okay. I don't think there's anything inherently wrong in multiple things sharing the same path, though it will further hinder the efforts to make --exclude and such actually run (or stop running) a specific thing. |
Great, thank you :) @WaffleLapkin this is ready to merge once you fix the conflicts :) |
9791b9f
to
97aaa15
Compare
In particular, this allows `CargoClippy` and `Clippy` to both use `src/tools/clippy` as the path.
97aaa15
to
472c3a4
Compare
@bors r+ |
@WaffleLapkin I found that even clippy has the sysroot bug you mentioned for miri - I think we need to be doing some extra magic (maybe with @bors r- this isn't useful as-is |
☔ The latest upstream changes (presumably #106520) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm going to close this in favor of #110365. Thank you for your work on this! It made the ongoing work easier :) |
It's nice to hear someone is working on this again! Especially because it did not look like I'd be able to work on this anytime soon 😅 |
As the title suggest, this makes bootstrap add tools to sysroot after building them. This allows the tools to be used with rustup, e.g.
Resolves #97762
Resolves #81431
r? @jyn514
I copied the implementation from the same thing with rustdoc (link), however there are some questions/problems:
miri
in the sysroot? It seems like the only way to run miri is throwcargo-miri
...cargo-clippy
andclippy-driver
in the sysroot?